package StringDemo1;

public class StringTest2
{
    public static void main(String[] args) {

        System.out.println(getcode(5));
    }
public static String getcode(int n)
{
    //用string变量记住所有字符串，并打印
    String str = "ABCDEFGHIJKLMNOPQRSTUVWSYZ";
    String code = "";
    for(int i = 0;i<n;i++)
    {
        int index = (int)((Math.random()* str.length()));
        code += str.charAt(index);
    }

    return code;

}

}
